class User {
  constructor(name, hookFn) {
    // 钩子函数 -- 生命周期 函数
    hookFn.beforeCreate()
    this.hookFn = hookFn
    this.name = name
    // 
  }

  render() {
    this.hookFn.beforeMount()
    setTimeout(() => {
      this.hookFn.mounted()
    }, 10)
    return 'hello User'
  }
}

const u = new User('张三', {
  beforeCreate() {
    console.log('beforeCreate')
  },
  beforeMount() {
    console.log('beforeMount')
  },
  mounted() {
    console.log('mounted')
  }
})

console.log(u.render())
